package com.matrix.storage.mapper;

import com.matrix.storage.dto.StorageSpaceDTO;
import com.matrix.storage.entity.StorageSpace;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface StorageSpaceMapper {

    @Insert("insert into storage_spaces (id, company_id, folder_name, create_time, update_time, total_capacity, used_capacity, expiration_date, status) "
            + "VALUES(#{id}, #{companyId}, #{folderName}, #{createTime}, #{updateTime}, #{totalCapacity}, #{usedCapacity}, #{expirationDate}, #{status})" )
    void insert(StorageSpace storageSpace);

    @Select("select * from storage_spaces where company_id = #{companyId} LIMIT 1")
    List<StorageSpace> getByCompanyId(String companyId);

    void update(StorageSpaceDTO storageSpaceDTO);
}
